import { readFileSync } from 'fs';
import { join } from 'path';
import * as yaml from 'js-yaml';

const envFileName = {
  development: 'dev',
  test: 'test',
  production: 'pro',
};

const env: string = process.env.NODE_ENV as string;

export default () => {
  return yaml.load(readFileSync(join(__dirname, `./env/${envFileName[env]}.yml`), 'utf8')) as Record<string, any>;
};
